using CardGameObject.GameScene;
using Common;

namespace CardEffect
{
    public class DeckEffect
    {
        private GameManager GameManager { get; set; } = GameManager.GetInstance();

        public void ShuffleDeck()
        {
            if(GameManager.CurLaunchRole == PlayerRoleEnum.PLAYER)
            {
                GameManager.PlayerDeck.GetComponent<GameDeck>().ShuffleDeck();
            }
            else
            {
                GameManager.AiDeck.GetComponent<GameDeck>().ShuffleDeck();
            }
        }

    
        public void DrawCards(int count)
        {
            if (GameManager.CurLaunchRole == PlayerRoleEnum.PLAYER)
            {
                GameManager.PlayerDeck.GetComponent<GameDeck>().DrawCards(count);
            }
            else
            {
                GameManager.AiDeck.GetComponent<GameDeck>().DrawCards(count);
            }
        }

        public void DrawCardByCardId(long cardId)
        {
            if(GameManager.CurLaunchRole == PlayerRoleEnum.PLAYER)
            {
                GameManager.CreateCardOnHandPosition(GameManager.CurLaunchRole, GameManager.PlayerDeck.GetComponent<GameDeck>().PlayerDeckCardList.Find(card => card.CardId == cardId));
            }
        }
    }
}